Skip to content

docs(ui): add ButtonGroup stories to storybook#1964

Merged
ghostdevv merged 2 commits intonpmx-dev:mainfrom
cylewaitforit:sb-button-group
Mar 21, 2026
Merged

docs(ui): add ButtonGroup stories to storybook#1964
ghostdevv merged 2 commits intonpmx-dev:mainfrom
cylewaitforit:sb-button-group

Conversation

@cylewaitforit
Copy link
Contributor

@cylewaitforit cylewaitforit commented Mar 6, 2026

🔗 Linked issue

Part of #1841

🧭 Context

Adds stories for ButtonGroup

Preview npmx Storybook on Chromatic

📚 Description

  • Created ButtonGroup.stories.ts
  • Moves ButtonBase stories from Base.stories.ts to ButtonBase.stories.ts
  • Enables internationalization in ButtonGroup and ButtonBase stories.
  • Enables autodocs page for ButtonBase and ButtonGroup

@vercel
Copy link

vercel bot commented Mar 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Mar 21, 2026 1:23am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Mar 21, 2026 1:23am
npmx-lunaria Ignored Ignored Mar 21, 2026 1:23am

Request Review

@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 6, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Refactors Storybook configuration and button stories: adds the storybook-i18n addon and LOCALE_CHANGED handling, creates a dedicated theme module (npmxDark) used by manager and preview, injects docs theme and a docs canvas background CSS, and removes a fault-tolerant wrapper around vue-docgen-plugin. Moves Button stories from a deleted Base.stories.ts into new ButtonBase.stories.ts and ButtonGroup.stories.ts, and adds component name declarations via defineOptions in Button Base and Group components. Updates package.json and pnpm-workspace.yaml to include storybook-i18n and extends knip.ts ignoreDependencies.

Possibly related PRs

Suggested labels

front

Suggested reviewers

  • danielroe
  • JReinhold
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description clearly relates to the changeset, detailing the addition of ButtonGroup stories, migration of ButtonBase stories, and i18n/autodocs enablement.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.storybook/preview.ts (1)

85-85: Avoid using any type for i18n instance.

The i18nInstance is typed as any, which bypasses TypeScript's type checking. Consider using the appropriate type from vue-i18n or at minimum a more descriptive interface.

🛠️ Suggested improvement
-      let i18nInstance: any = null
+      let i18nInstance: { setLocale: (locale: string) => void } | null = null

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b33c7bfb-2b5b-4119-9765-c992b32e7ac6

📥 Commits

Reviewing files that changed from the base of the PR and between fee116c and 9e9acdb.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (12)
  • .storybook/main.ts
  • .storybook/manager.ts
  • .storybook/preview-head.html
  • .storybook/preview.ts
  • .storybook/theme.ts
  • app/components/Button/Base.stories.ts
  • app/components/Button/Base.vue
  • app/components/Button/Button.stories.ts
  • app/components/Button/ButtonGroup.stories.ts
  • app/components/Button/Group.vue
  • package.json
  • pnpm-workspace.yaml
💤 Files with no reviewable changes (1)
  • app/components/Button/Base.stories.ts

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4ca6d486-6d91-452a-9455-9d655cca0738

📥 Commits

Reviewing files that changed from the base of the PR and between 9e9acdb and 98f10f2.

📒 Files selected for processing (2)
  • .storybook/theme.ts
  • knip.ts

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c3e058ab-44b3-47cc-ab0d-2d13215a73a5

📥 Commits

Reviewing files that changed from the base of the PR and between b413402 and 3962167.

📒 Files selected for processing (1)
  • app/components/Button/ButtonBase.stories.ts

Comment on lines +21 to +25
export const Default: Story = {
args: {
default: 'Button Text',
},
}
Copy link
Contributor

@coderabbitai coderabbitai bot Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Default story may not render slot content without a render function.

All other stories use explicit render functions with templates to handle slot content, but Default relies on args.default without a render function. In Vue Storybook, this pattern typically requires either a render function or specific argTypes configuration to pass slot content properly.

Consider adding a render function for consistency and to ensure the button text displays:

Proposed fix
 export const Default: Story = {
-  args: {
-    default: 'Button Text',
-  },
+  render: args => ({
+    components: { ButtonBase },
+    setup() {
+      return { args }
+    },
+    template: `<ButtonBase v-bind="args">Button Text</ButtonBase>`,
+  }),
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const Default: Story = {
args: {
default: 'Button Text',
},
}
export const Default: Story = {
render: args => ({
components: { ButtonBase },
setup() {
return { args }
},
template: `<ButtonBase v-bind="args">Button Text</ButtonBase>`,
}),
}

Copy link
Contributor Author

@cylewaitforit cylewaitforit Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping the default story with the default render allow to someone viewing the storybook to change the story to alternative text in place of Button Text. The other stories use the template render in order for the internationalization to work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cylewaitforit, that makes perfect sense! Using args.default without a render function is the correct approach here — it exposes the slot content as a Storybook control, allowing users to interactively edit the button text directly from the controls panel. The render function approach in the other stories is needed for i18n to work, but would prevent that interactive editing for the Default story. Thanks for the clarification!

ʕ •`ᴥ´• ʔ


✏️ Learnings added
Learnt from: cylewaitforit
Repo: npmx-dev/npmx.dev PR: 1964
File: app/components/Button/ButtonBase.stories.ts:21-25
Timestamp: 2026-03-06T18:16:31.538Z
Learning: In the npmx.dev project's ButtonBase.stories.ts (app/components/Button/ButtonBase.stories.ts), the `Default` story intentionally uses `args.default` without a render function so that Storybook users can interactively edit the slot content (button text) via the controls panel. Other stories (e.g. Primary, Secondary, etc.) use explicit render functions with templates specifically to support storybook-i18n internationalization. Do not flag the `Default` story's lack of a render function as an issue.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: userquin
Repo: npmx-dev/npmx.dev PR: 1335
File: app/components/Compare/FacetSelector.vue:72-78
Timestamp: 2026-02-10T15:47:40.710Z
Learning: In the npmx.dev project, the `ButtonBase` component (app/components/ButtonBase.vue or similar) provides default `border border-border` styles. When styling ButtonBase instances, avoid adding duplicate `border` classes as this triggers the HTML validator error `no-dup-class` and fails CI.

Learnt from: cylewaitforit
Repo: npmx-dev/npmx.dev PR: 1964
File: .storybook/preview-head.html:1-6
Timestamp: 2026-03-06T17:44:59.085Z
Learning: In the npmx.dev project, the `.storybook/preview-head.html` file sets `background-color` on `.docs-story` via the `--bg` CSS custom property to fix the Autodocs canvas background. This is an intentional workaround for a known Storybook bug (storybookjs/storybook#30928) where `addon-themes` and `parameters.docs.theme` do not apply to the individual story canvas iframes in the Autodocs tab. Removing this file causes the autodocs pages to not display correctly.

@ghostdevv
Copy link
Contributor

Could you mark this as ready for review when you are? Then I'll take a look!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
app/components/Button/ButtonGroup.stories.ts (1)

26-106: Reduce the duplicated story markup.

Each story now maintains the same example twice: once in docs.source.code and again in render().template. That is easy to drift on the next edit and makes these stories more expensive to maintain than they need to be. A small helper or shared story data would keep the docs snippet and live render in sync.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a4a594fa-72da-4dbd-b9df-2f2dfca19696

📥 Commits

Reviewing files that changed from the base of the PR and between 3962167 and a923dd3.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (13)
  • .storybook/main.ts
  • .storybook/manager.ts
  • .storybook/preview-head.html
  • .storybook/preview.ts
  • .storybook/theme.ts
  • app/components/Button/Base.stories.ts
  • app/components/Button/Base.vue
  • app/components/Button/ButtonBase.stories.ts
  • app/components/Button/ButtonGroup.stories.ts
  • app/components/Button/Group.vue
  • knip.ts
  • package.json
  • pnpm-workspace.yaml
💤 Files with no reviewable changes (1)
  • app/components/Button/Base.stories.ts
🚧 Files skipped from review as they are similar to previous changes (8)
  • .storybook/theme.ts
  • app/components/Button/Group.vue
  • knip.ts
  • pnpm-workspace.yaml
  • app/components/Button/ButtonBase.stories.ts
  • .storybook/main.ts
  • app/components/Button/Base.vue
  • package.json

@cylewaitforit cylewaitforit marked this pull request as draft March 11, 2026 03:59
@cylewaitforit
Copy link
Contributor Author

Could you mark this as ready for review when you are? Then I'll take a look!

@ghostdevv Ready when you have time.

@cylewaitforit cylewaitforit marked this pull request as draft March 17, 2026 19:42
@cylewaitforit
Copy link
Contributor Author

Moving this back to draft since it has drifted from main and #2062 and #2125 should probably be merged separately first.

@ghostdevv ghostdevv added this pull request to the merge queue Mar 21, 2026
Merged via the queue into npmx-dev:main with commit c17f0f5 Mar 21, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants